#include "../inc/SkyBox.h"

void SkyBox::setDimensions ( GLfloat w, GLfloat h, GLfloat d )
{
     printf("Passou pelo setDimensions correto\n");
     // Dimensiona as faces da caixa
     sides[Box::FRONT].setSize(w, h);
     sides[Box::FRONT].rotate( CoordF( 0, 180, 0 ) );
  
     sides[Box::LEFT].setSize(d, h);
     sides[Box::LEFT].rotate( CoordF( 0, 90, 0 ) );
  
     sides[Box::BACK].setSize(w, h);
  
     sides[Box::RIGHT].setSize(d, h);
     sides[Box::RIGHT].rotate( CoordF( 0, -90, 0 ) );
  
     sides[Box::TOP].setSize(w, d);
     sides[Box::TOP].rotate( CoordF( 90, 0, 0 ) );
  
     sides[Box::BOTTOM].setSize(w, d);
     sides[Box::BOTTOM].rotate( CoordF( -90, 0, 0 ) );
  
     width = w;
     height = h;
     depth = d;
}

void SkyBox::setTex ( const char * tex )
{
  for (int i=0; i<6; i++)
    sides[i].material()->setMaterial(tex, Texture::SKYBOX);
}

void SkyBox::setTex ( const char * texarray[6] )
{
  for (int i=0; i<6; i++)
    sides[i].material()->setMaterial(texarray[i], Texture::SKYBOX);
}

void SkyBox::draw()
{
     glDisable(GL_LIGHTING);
     glColor4f(1.0,1.0,1.0,1.0);
     glPushMatrix();
       Box::draw();
     glPopMatrix();
     glColor4f(1.0,1.0,1.0,1.0);
     glEnable(GL_LIGHTING);
}
